<template>
	<view class="content">
		<view class="top_box">
			<view class="item">
				<text class="text">可提现</text>
				<view class="n">
					<text class="num">{{info.income || 0}}</text>
					<text class="t">元</text>
				</view>
			</view>
			<view class="item">
				<text class="text">已提现</text>
				<view class="n">
					<text class="num">{{info.cashWithdrawalAmount || 0}}</text>
					<text class="t">元</text>
				</view>
				<view class="btn" @click="handleToCashList" v-if="info.cashWithdrawalAmount > 0">
					提现记录
				</view>
			</view>
		</view>
		<view class="con_box">
			<view class="title">
				提现金额
			</view>
			<view class="input">
				<text>￥</text>
				<input type="text" v-model="amount" />
			</view>
		</view>
		<view class="con1_box">
			<view class="title">
				收款信息
			</view>
			<view class="item" style="border-bottom: 1px solid #E8E8E8;">
				<text>收款账号</text>
				<input type="text" v-model="receivePaymentAccount" placeholder="请输入银行卡号" />
			</view>
			<view class="item">
				<text>收款银行</text>
				<input type="text" v-model="receivePaymentBank" placeholder="请输入所属银行" />
			</view>
		</view>
		<view class="button" @click="handleSubmit">
			提交申请
		</view>
		<view class="bot_box">
			<view class="title">
				提现规则
			</view>
			<view class="dec" v-html="text">
				
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				info:'',
				text:'',
				amount:'',
				receivePaymentAccount:'',
				receivePaymentBank:'',
			}
		},
		onLoad() { 
			this.getDetail()
			this.getText()
		},
		methods:{ 
			
			getText(){
				this.$http({
					url:"/umsContent/queryById",
					method:"get",
					data:{
						id:5
					}
				}).then(data=>{
					this.text = data.content
				})
			},
			handleToCashList(){
				uni.navigateTo({
					url:"./cash_list"
				})
			},
			getDetail(){
				this.$http({
					url:"/umsVault/queryOwnInfo",
					method:"get"
				}).then(data=>{
					this.info = data
				})
			},
			handleSubmit(){
				if(this.amount == ''){
					uni.showToast({
						title:"请输入提现金额",
						icon:"none"
					})
					return
				}
				if(this.receivePaymentAccount == ''){
					uni.showToast({
						title:"请输入收款账号",
						icon:"none"
					})
					return
				}
				if(this.receivePaymentBank == ''){
					uni.showToast({
						title:"请输入收款银行",
						icon:"none"
					})
					return
				}
				this.$http({
					url:"/umsCashWithdrawal/add",
					method:"post",
					data:{
						amount:this.amount,
						receivePaymentAccount:this.receivePaymentAccount,
						receivePaymentBank:this.receivePaymentBank
					}
				}).then(()=>{
					
				})
			}
		}
	}
</script>

<style>
	page{
		background: #F8F8F8;
	}
</style>

<style lang="scss" scoped>
	
	.button{
		width: 690rpx;
		height: 88rpx;
		background: #020202;
		border-radius: 50rpx;
		text-align: center;
		line-height: 88rpx; 
		margin: 0 auto; 
		color: #fff;
		font-size: 30rpx;
		margin-top: 30rpx;
	}
	.content{
		padding: 30rpx;
		.bot_box{ 
			background: #fff;
			padding: 24rpx;
			margin-top: 30rpx;
			.title{ 
				font-size: 30rpx;
				color: #020202;
				font-weight: bold;
				margin-bottom: 20rpx;
			}
			.dec{
				font-size: 24rpx;
				color: #666666;
				line-height: 40rpx;
			}
		}
		.con1_box{
			background: #fff;
			padding: 24rpx;
			margin-top: 30rpx;
			padding-bottom: 6rpx;
			.title{ 
				font-size: 30rpx;
				color: #020202;
				font-weight: bold;
				margin-bottom: 20rpx;
			}
			.item{
				display: flex;
				align-items: center;
				justify-content: space-between;
				height: 90rpx;
				text{
					font-size: 28rpx;
					color: #1C1C1C;
				}
				input{
					font-size: 28rpx;
					text-align: right;
				}
			}
		}
		.con_box{
			background: #fff;
			padding: 24rpx;
			box-sizing: border-box;
			margin-top: 30rpx;
			padding-bottom: 40rpx;
			.title{
				font-size: 30rpx;
				color: #020202;
				font-weight: bold;
				margin-bottom: 20rpx;
			}
			.input{
				display: flex;
				align-items: center;
				padding-bottom: 20rpx;
				border-bottom: 1px solid #E8E8E8;
				text{
					font-size: 48rpx;
					color: #020202;
					font-weight: bold;
					margin-right: 20rpx;
				}
				input{
					font-size: 48rpx;
				}
			}
		}
		.top_box{
			background: #fff;
			padding: 30rpx;
			box-sizing: border-box;
			display: flex; 
			.item{
				width: 49%;
				.btn{
					width: 124rpx;
					height: 40rpx;
					line-height: 40rpx;
					background: #FFFFFF;
					border-radius: 2rpx;
					border: 1rpx solid #666666;
					margin: 0 auto;
					text-align: center;
					font-size: 22rpx;
					color: #666666;
					margin-top: 12rpx;
				}
				&:first-child{
					height: 106rpx;
					border-right: 1px solid #DBDBDB;
					box-sizing: border-box;
				}
				.n{
					text-align: center;
					.num{
						font-size: 36rpx;
						color: #020202;
						font-weight: bold;
					}
					.t{
						font-size: 24rpx;
						color: #020202;
						margin-left: 6rpx;
						display: inline-block;
					}
				}
				.text{
					display: block;
					text-align: center;
					font-size: 24rpx;
					color: #999999;
					margin-bottom: 16rpx;
				}
			}
		}
	}
</style>